package proj.euler;

import junit.framework.Assert;

import org.junit.Test;

public class P2Test {
	@Test
	public void test1() {
		Assert.assertEquals(1, P2.f(1));
	}

	@Test
	public void test2() {
		Assert.assertEquals(2, P2.f(2));
	}

	@Test
	public void test3() {
		Assert.assertEquals(3, P2.f(3));
	}

	@Test
	public void test4() {
		Assert.assertEquals(5, P2.f(4));
	}

	@Test
	public void test10() {
		Assert.assertEquals(5, P2.f(89));
	}

	@Test
	public void testLess1() {
		Assert.assertEquals(1, P2.limitLastIndex(1));
	}

	@Test
	public void testLess2() {
		Assert.assertEquals(2, P2.limitLastIndex(2));
	}

	@Test
	public void testLess3() {
		Assert.assertEquals(3, P2.limitLastIndex(3));
	}

	@Test
	public void testLess4() {
		Assert.assertEquals(3, P2.limitLastIndex(4));
	}

	@Test
	public void testLess5() {
		Assert.assertEquals(4, P2.limitLastIndex(5));
	}

	@Test
	public void testLess100() {
		Assert.assertEquals(10, P2.limitLastIndex(100));
	}

	@Test
	public void testLess4000000() {
		Assert.assertEquals(32, P2.limitLastIndex(4000000));
	}
	
	@Test
	public void testEvenSumInLimit(){
		Assert.assertEquals(44, P2.evenSumInLimit(100));
	}
	@Test
	public void testEvenSumInLimit4000000(){
		Assert.assertEquals(4613732, P2.evenSumInLimit(4000000));
	}
}
